package com.sky.mapper;

import com.sky.dto.OrderCountDto;
import com.sky.dto.TopDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReportMapper {
    /**
     * 每日销量统计
     * @param map
     * @return
     */
    Double turnoverStatistics(Map map);

    /**
     * 查询每天注册用户的总数
     * @param begin
     * @param last
     * @return
     */
    @Select(" select count(id) from user where create_time between #{begin} and #{last}")
    Integer userStatistics(LocalDateTime begin, LocalDateTime last);

    /**
     * 查询用户的总数
     * @return
     */
    @Select(" select count(id) from user where create_time < #{last}")
    Integer userTotal( LocalDateTime last);

    Integer getOrdersByLimit(OrderCountDto build);

    /**
     * 每日销售前十的菜品
     * @param start
     * @param last
     */
    List<TopDto> getTop10(LocalDateTime start, LocalDateTime last);
}
